package _5_singleton

type Singleton struct {
	name string
}
//懒汉式
//var singleton *Singleton
//
//var one sync.Once
//
//func GetInstance()  *Singleton{
//	one.Do(func() {
//		fmt.Println("初始化Singleton...")
//		singleton = &Singleton{}
//	})
//	return singleton;
//}

//饿汉式
var singleton = &Singleton{}

func GetInstance() *Singleton  {
	return singleton
}

